﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;

namespace SyzsAsync
{
    public static class SyzsInfoAsync
    {
        private static SyzsAsync.SyzsWsPort.CxfWebServiceApiClient client = new SyzsAsync.SyzsWsPort.CxfWebServiceApiClient();
        public static SyzsAsync.SyzsWsPort.sysUserOfWs GetUserInfo(string userid, string pwd)
        {
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                try
                {
                    var httpRequestProperty = new HttpRequestMessageProperty();
                    httpRequestProperty.Headers["code"] = "MTkwNjAxMDE=";
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                    return client.getUserInfo(userid, pwd);
                }
                catch (Exception exp)
                {
                    return null;
                }

            }
        }

        public static SyzsAsync.SyzsWsPort.sycpxx[] GetProductInfo(string coid)
        {
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                try
                {
                    var httpRequestProperty = new HttpRequestMessageProperty();
                    httpRequestProperty.Headers["code"] = "MTkwNjAxMDE=";
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                    return client.getSycps(coid);
                }
                catch (Exception exp)
                {
                    return null;
                }
            }

        }
    }
}
